home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C03 / Scope.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  740 b   |  32 lines

  1. //: C03:Scope.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // How variables are scoped
  7. int main() {
  8.   int scp1;
  9.   // scp1 visible here
  10.   {
  11.     // scp1 still visible here
  12.     //.....
  13.     int scp2;
  14.     // scp2 visible here
  15.     //.....
  16.     {
  17.       // scp1 & scp2 still visible here
  18.       //..
  19.       int scp3;
  20.       // scp1, scp2 & scp3 visible here
  21.       // ...
  22.     } // <-- scp3 destroyed here
  23.     // scp3 not available here
  24.     // scp1 & scp2 still visible here
  25.     // ...
  26.   } // <-- scp2 destroyed here
  27.   // scp3 & scp2 not available here
  28.   // scp1 still visible here
  29.   //..
  30. } // <-- scp1 destroyed here
  31. ///:~
  32.